home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / Erreurs de films (FR).ifs < prev    next >
Encoding:
Text File  |  2004-10-31  |  12.6 KB  |  419 lines

  1. // GETINFO SCRIPTING
  2. // ErreursDeFilms.com - Recherche d'erreurs dans des films - by ScorEpioN
  3.  
  4. (***************************************************
  5.  *  Script d'importation pour :                    *
  6.  *  ErreursDeFilms , www.erreursdefilms.com        *
  7.  *                                                 *
  8.  *  Script by ScorEpioN                            *
  9.  *                                                 *
  10.  *  Version : 7 - Update du 31/10/2004             *
  11.  *                                                 *
  12.  *  A utiliser avec Ant Movie Catalog 3.4.0        *
  13.  *  www.ant.be.tf/moviecatalog ╖╖╖ www.buypin.com  *
  14.  *                                                 *
  15.  *  The source code of the script can be used in   *
  16.  *  another program only if full credits to        *
  17.  *  script author and a link to Ant Movie Catalog  *
  18.  *  website are given in the About box or in       *
  19.  *  the documentation of the program               *
  20.  ***************************************************)
  21.  
  22. program ErreurDeFilm_SEARCH;
  23.  
  24. const
  25.   ConfirmTitre = True;
  26.     { True: Demande le titre avant de lancer le script
  27.       False: Ne demande pas le titre avant de lancer le script }
  28. var
  29.   MovieName, NomFilm, Adresse, Parametre, Reponse : string;
  30.   premiereExecution : Integer;
  31.   
  32. //------------------------------------------------------------------------------
  33. // ANALYSE DE LA PAGE DES FILMS
  34. //------------------------------------------------------------------------------
  35.  
  36. procedure AnalyzePage(Address, Params: string);
  37. var
  38.   Line, aucun_film,page_film,titre_film, la_page : string;
  39.   BeginPos, EndPos, compteur: Integer;
  40.   
  41.   begin
  42. //vide la liste des films
  43.   PickTreeClear;
  44.  
  45. //charge la page
  46.   Address := URLEncode(Address);
  47.   Params := URLEncode(Params);
  48.   Line := PostPage(Address,Params);
  49.   aucun_film := Line;
  50.   
  51. //teste si il y a des films trouvΘs
  52.   BeginPos := Pos('<tr><td colspan="3" align="center"><b>RΘsultats sur les titres</b><br><br></td></tr>', aucun_film);
  53.   if BeginPos <> 0 then 
  54.   begin
  55.   Delete(aucun_film, 1, BeginPos);
  56.   BeginPos := Pos('<tr><td colspan=3 align=center>Aucun rΘsultat α votre recherche</td></tr>', aucun_film);
  57.   if BeginPos <> 0 then  
  58.   begin
  59.     titre_film := MovieName;
  60.     titre_film := Trim(titre_film);
  61.     titre_film := AnsiLowerCase(titre_film);
  62.     titre_film := AnsiUpFirstLetter(titre_film);  
  63.     showmessage('Aucune erreur trouvΘe pour : ' + titre_film);
  64.     exit;
  65.   end;
  66.   end;
  67.  
  68. //introduction rΘsultats  
  69.   titre_film := MovieName;
  70.   titre_film := AnsiUpFirstLetter(titre_film);
  71.   PickTreeAdd('Erreurs trouvΘes pour le film ' + titre_film + ' :', '');  
  72.   
  73. //compte les rΘsultats
  74.   compteur := 0;
  75.   
  76.   BeginPos := Pos('<td>Titre</td>', Line);
  77.   Delete(Line, 1, BeginPos+14);
  78.   
  79. //cherche le lien de la page du film
  80.   BeginPos := Pos('<td><a href=', Line);  
  81.   
  82.   repeat
  83.   Delete(Line, 1, BeginPos+12);
  84.   EndPos := Pos('>', Line);
  85.   page_film := 'http://www.erreursdefilms.com/' + Copy(Line, 1, EndPos-2 );
  86.   page_film := URLEncode(page_film);
  87. //cherche le nom du film
  88.   BeginPos := Pos('>',Line);
  89.   Delete(Line, 1, BeginPos);
  90.   EndPos := Pos('</a></td>',Line);
  91.   titre_film := Copy(Line, 1, EndPos-1 );
  92.   HTMLdecode(titre_film);
  93.   HTMLremovetags(titre_film);
  94.   titre_film := Trim(titre_film);
  95.   titre_film := AnsiLowerCase(titre_film);
  96.   titre_film := AnsiUpFirstLetter(titre_film);
  97.   if titre_film <> '' then
  98.   begin
  99. //ajoute les films
  100.     PickTreeAdd(titre_film , page_film);
  101.     la_page := page_film;
  102.     compteur := compteur+1;
  103.   end;
  104. //cherche le lien de la page du film
  105.   BeginPos := Pos('<td><a href=', Line);
  106.   until BeginPos = 0;
  107.   
  108.   if compteur = 1 then
  109.   begin
  110.     AnalysePageFilm(la_page);
  111.     exit;
  112.   end;
  113.  
  114.   PickTreeAdd(' ', '');
  115.   PickTreeAdd('Verifier si vous avez la derniΦre version', 'version');
  116.  
  117.   begin
  118.     if PickTreeExec(Address)=true then
  119.     begin
  120.       if (Address = 'version') then
  121.       begin
  122.         verifVersion();
  123.       end else
  124.       begin
  125.         AnalysePageFilm(Address);
  126.       end;
  127.     end;
  128.   end;
  129. end;
  130.  
  131. //------------------------------------------------------------------------------
  132. // VERIFIER LA VERSION DU SCRIPT
  133. //------------------------------------------------------------------------------
  134.  
  135. procedure verifVersion();
  136. var
  137.    Line, NewVersion, MaVersion, Telecharge : String;
  138.    BeginPos, EndPos : Integer;
  139. begin
  140.   MaVersion := '7';
  141.   Line := GetPage('http://forum.antp.be/phpbb2/viewtopic.php?t=1453');
  142.   BeginPos := pos('TELECHARGER LE SCRIPT ERREURS DE FILMS v', Line);
  143.   delete(Line,1, BeginPos+39);
  144.   EndPos := pos('du', Line);
  145.   NewVersion := copy(Line, 1, EndPos - 2);
  146.   PickTreeClear;
  147.   PickTreeAdd('Votre version est la '+MaVersion+', la derniΦre est la '+NewVersion+'.', '');
  148.   PickTreeAdd('Pour tΘlΘcharger la derniΦre version :', '');
  149.   PickTreeAdd('Cliquez ici', 'DL');
  150.   PickTreeAdd('Le script sera tΘlΘcharger dans le mΩme rΘpertoire que votre catalogue', '');
  151.   PickTreeAdd('Cliquez sur annuler pour quitter', '');
  152.   begin
  153.     if PickTreeExec(Telecharge)=true then
  154.       if (Telecharge = 'DL') then
  155.       begin
  156.         GetPicture('http://www.ifrance.com/ricoland/Erreurs%20de%20films%20(FR).ifs', True);
  157.       end else
  158.       begin
  159.         exit;
  160.       end;
  161.     end;
  162. end;
  163.  
  164. //------------------------------------------------------------------------------
  165. // ANALYSE DE LA PAGE DU FILM
  166. //------------------------------------------------------------------------------
  167.  
  168. procedure AnalysePageFilm(Address: string);
  169. var
  170.   Line,les_erreurs, erreur, detail_erreur : string;
  171.   BeginPos, EndPos: Integer;
  172.   
  173. begin
  174. //charge la page
  175.   Address := URLEncode(Address);
  176.   Line := GetPage(Address);
  177.   
  178.   les_erreurs := 'Liste des erreurs :';
  179.  
  180. //cherche les erreurs 
  181.   BeginPos := Pos('<td width=''*'' valign=''top''>', Line);
  182.   if BeginPos <> 0 then
  183.   begin
  184.     repeat 
  185.       Delete(Line, 1, BeginPos+26);
  186.       BeginPos := Pos('<b>', Line);
  187.       Delete(Line, 1, BeginPos+2);
  188.       EndPos := Pos('</b><br>', Line);
  189. //type d'erreur 
  190.       erreur := copy(Line,1,EndPos-1);
  191.       erreur := StringReplace(erreur , #13#10, ' ');
  192.       erreur := #13#10#13#10 + erreur + #13#10;
  193.       Delete(Line, 1, EndPos+7);
  194.       EndPos := Pos('</b><br>', Line);
  195. //l'erreur en dΘtail
  196.       detail_erreur := copy(Line,1,EndPos-1);
  197.       detail_erreur := StringReplace(detail_erreur , #13#10, ' ');
  198.       detail_erreur := Trim(detail_erreur);
  199.       erreur := erreur + detail_erreur + ' -';
  200.       erreur := StringReplace(erreur , '<br>          <b>', ' - ');
  201.       erreur := StringReplace(erreur , '          ', '');
  202.       erreur := Trim(erreur);
  203.       les_erreurs := les_erreurs + erreur;
  204.       BeginPos := Pos('<td width=''*'' valign=''top''>', Line);
  205.     until BeginPos = 0;
  206.   end;
  207.   
  208.  les_erreurs := les_erreurs + #13#10#13#10 + 'Informations provenant du site www.erreursdefilms.com';
  209.  
  210. //charge les rΘsultats dans la fenΩtre
  211.   SetField( fieldOriginalTitle,GetField(fieldOriginalTitle));
  212.   SetField( fieldTranslatedTitle,GetField(fieldTranslatedTitle));
  213.   if (GetField(fieldComments) <> '') then
  214.   begin
  215.     les_erreurs := GetField(fieldComments)+ #13#10#13#10 + les_erreurs;
  216.     SetField( fieldComments,les_erreurs);
  217.   end else
  218.   begin
  219.     SetField( fieldComments,les_erreurs);      
  220.   end;
  221.   DisplayResults;
  222. end;
  223.  
  224. //------------------------------------------------------------------------------
  225. // PROCEDURE DE DEBUG AVEC ECRITURE DANS UN FICHIER
  226. //------------------------------------------------------------------------------
  227.  
  228. procedure debug (la_ligne : String);
  229. var
  230.   Page: TStringList;
  231.   LineNr: Integer;
  232.   fichier: string;
  233. begin
  234.   fichier := 'D:\Mes documents\dossier personnel\temp\DEBUG.HTM';
  235.   Page := TStringList.Create;
  236.   Page.Text := la_ligne;
  237.   Page.SaveToFile(fichier); 
  238. end;
  239.  
  240. //------------------------------------------------------------------------------
  241. // NETTOIE LE TITRE DU FICHIER POUR AVOIR LE TITRE DE FILM
  242. //------------------------------------------------------------------------------
  243.  
  244. function cleanTitle(title : String) : string;
  245. var
  246.   i,j, fin : Integer;
  247.   temp : String;
  248.  
  249. begin
  250.   title := AnsiUpperCase(title);
  251.  
  252.   if title <> '' then
  253.   begin
  254. // Nettoie les tags fichiers, merci Atmosfear pour les tags
  255.   i:=pos('.DVD',title);
  256.   if i <> 0 then
  257.   begin
  258.     title := copy(title,1,i-1);
  259.   end;
  260.   i:=pos('.DIVX',title);
  261.   if i <> 0 then
  262.   begin
  263.     title := copy(title,1,i-1);
  264.   end;
  265.   i:=pos('.FREN',title);
  266.   if i <> 0 then
  267.   begin
  268.     title := copy(title,1,i-1);
  269.   end;
  270.   i:=pos('.GERM',title);
  271.   if i <> 0 then
  272.   begin
  273.     title := copy(title,1,i-1);
  274.   end;
  275.   i:=pos('.INT',title);
  276.   if i <> 0 then
  277.   begin
  278.     title := copy(title,1,i-1);
  279.   end;
  280.   i:=pos('.LIM',title);
  281.   if i <> 0 then
  282.   begin
  283.     title := copy(title,1,i-1);
  284.   end;
  285.   i:=pos('.PROP',title);
  286.   if i <> 0 then
  287.   begin
  288.     title := copy(title,1,i-1);
  289.   end;
  290.   i:=pos('.REPACK',title);
  291.   if i <> 0 then
  292.   begin
  293.     title := copy(title,1,i-1);
  294.   end;
  295.   i:=pos('.SUBB',title);
  296.   if i <> 0 then
  297.   begin
  298.     title := copy(title,1,i-1);
  299.   end;
  300.   i:=pos('.UNSUB',title);
  301.   if i <> 0 then
  302.   begin
  303.     title := copy(title,1,i-1);
  304.   end;
  305.   i:=pos('.WS',title);
  306.   if i <> 0 then
  307.   begin
  308.     title := copy(title,1,i-1);
  309.   end;
  310.   i:=pos('.XVID',title);
  311.   if i <> 0 then
  312.   begin
  313.     title := copy(title,1,i-1);
  314.   end;
  315.   i:=pos('.AC3',title);
  316.   if i <> 0 then
  317.   begin
  318.     title := copy(title,1,i-1);
  319.   end;
  320.   i:=pos('.UNRAT',title);
  321.   if i <> 0 then
  322.   begin
  323.     title := copy(title,1,i-1);
  324.   end;
  325.  
  326.    title := StringReplace(title, '.', ' ');
  327.    title := StringReplace(title, ',', ' ');
  328.    title := StringReplace(title, ':', '');
  329.    title := StringReplace(title, '-', '');
  330.    title := StringReplace(title, '  ', ' ');
  331.  
  332.    i := 0;
  333. // Nettoie les tags de team
  334.    if (pos('(',title) <> 0) then
  335.    begin
  336.      i := pos('(',title);
  337.      temp := copy(title,0,i-1);
  338.      j := pos(')',title);
  339.      fin := Length(title);
  340.      title := temp + copy(title,j+1,fin);
  341.    end;
  342.  
  343.    if (pos('[',title) <> 0) then
  344.    begin
  345.      i := pos('[',title);
  346.      temp := copy(title,1,i-1);
  347.      j := pos(']',title);
  348.      fin := Length(title);
  349.      title := temp + copy(title,j+1,fin);
  350.    end;
  351.  
  352.    title := AnsiLowerCase(title);
  353.    title := AnsiUpFirstLetter(title);
  354.    title := AnsiMixedCase(title,' -');
  355.   end;
  356.    result := title;
  357. end;
  358.  
  359. //------------------------------------------------------------------------------
  360. // PROGRAMME PRINCIPAL
  361. //------------------------------------------------------------------------------
  362.  
  363. begin
  364.   if CheckVersion(3,4,0) then
  365.   begin
  366.     MovieName := GetField(fieldTranslatedTitle);
  367.     if MovieName = '' then
  368.       MovieName := GetField(fieldOriginalTitle);
  369.     MovieName := cleanTitle(MovieName);
  370.     if (ConfirmTitre = True) then
  371.     begin
  372.     if Input('Erreurs de Films by ScorEpioN', 'Entrez le titre du film :', MovieName) then
  373.     begin
  374.       //remplace les caractΦres accentuΘs
  375.       NomFilm := MovieName;
  376.       NomFilm := AnsiLowerCase(NomFilm);
  377.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  378.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  379.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  380.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  381.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  382.       Adresse := URLEncode('http://www.erreursdefilms.com/resrech.php');
  383.       Parametre := URLEncode('rechtxt='+NomFilm+'&typerech=tous');
  384.       AnalyzePage(Adresse, Parametre);
  385.     end;
  386.     end else
  387.     begin
  388.       NomFilm := MovieName;
  389.       NomFilm := AnsiLowerCase(NomFilm);
  390.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  391.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  392.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  393.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  394.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  395.       Adresse := URLEncode('http://www.erreursdefilms.com/resrech.php');
  396.       Parametre := URLEncode('rechtxt='+NomFilm+'&typerech=tous');
  397.       if (premiereExecution = 0) then
  398.       begin
  399.           premiereExecution := -1;
  400.       PickTreeClear;
  401.           PickTreeAdd('Vous allez executer le script Erreurs de films sans confirmation', '');
  402.           PickTreeAdd('Cliquez ici pour continuer', 'Oui');
  403.       PickTreeAdd('Cliquez sur annuler pour ne pas executer le script', '');
  404.       begin
  405.         if PickTreeExec(Reponse)=true then
  406.               if (Reponse = 'Oui') then
  407.               begin
  408.               AnalyzePage(Adresse, Parametre);
  409.         end;
  410.       end;
  411.       end else
  412.       begin
  413.         AnalyzePage(Adresse, Parametre);
  414.       end;
  415.     end;
  416.   end else
  417.     ShowMessage('Ce script requiert une version plus rΘcente de Ant Movie Catalog (au moins la version 3.4.0)');
  418. end. 
  419.